1 NodeJS中的异步实现
2 libuv
中的事件阶段
- 执行到点的定时器
- 执行
pending
回调 - 执行
idle
操作 - 执行
prepare
操作 - 监听
I/O
请求 - 执行
check
操作 - 执行
close
回调
3 源码分析
3.1 nodejs
主文件/src/node.cc
1 | do { |
3.2 libuv
分平台/deps/uv/src/unix/core.c
1 | int uv_run(uv_loop_t* loop, uv_run_mode mode) { |
4 参考资料
- 《深入浅出NodeJS》
- 深入理解Node.js:核心思想与源码分析
- 深入理解Node.js:核心思想与源码分析
- node源码详解(二 )—— 运行机制 、整体流程
- 从Chrome源码看浏览器的事件机制
- 事件循环机制 Event-Loop及其延伸
- 【朴灵评注】JavaScript 运行机制详解:再谈Event Loop
- 一次弄懂Event Loop(彻底解决此类面试问题)
- Event loop in JavaScript
- libevent github
- libevent org
- libuv github
- libuv org
- Node.js挖掘系列
最后更新: 2022年03月02日 03:32
原始链接: http://rawbin-.github.io/browser/2017-05-09-js-event-loop-src/